<div class="modal fade" id="nuevoProyecto" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:900px">

        <div class="modal-content" style="border-radius:0 !important;position:relative !important;">
            <div class="aspa" data-dismiss="modal" aria-hidden="true" style="right:-10px;top:-10px;" title="Cerrar">
                <i class="glyphicon glyphicon-remove"></i>
            </div>
            <div class="modal-header" style="color:white;background-color:#5789ae;color:white;border-bottom:black solid 2px">
                <h4 class="modal-title" id="myModalLabel" style="font-weight:bold">Nuevo proyecto</h4>
            </div>

            <div class="modal-body">

                <form method="post" name="nuevoProyecto" action="../logic/registrarPlan.php" onsubmit="return validarFormulario()">
                    <div style="float:left;width:49%;padding-right:10px;">
                        <div class="campo">
                            <b>Título</b>
                            <input class="input" maxlength="100" type="text"  name="titular" id="titular" style="border:solid silver 1px"></input></td>
                        </div>
                        <div class="campo" style="height:80px;">
                            <b>Descripcion</b>
                            <textarea class="input" maxlength="1000" style="height:210px;" id="descripcion" name="descripcion"></textarea>
                        </div>
                    </div>
                    <div style="float:left;width:49%;">
                        <div class="campo">
                            <b>Provincia</b>
                            <select class="input"name="provincia" id="provincia">
                                <option value="0">Todas</option>
                            </select>
                        </div>
                        <div class="campo">
                            <b>Municipio</b>
                            <select class="input" name="municipio" id="municipio">
                                <option value="0">Todos</option>
                            </select>
                        </div>
                        <div class="campo">
                            <b>Proyecto</b>
                            <select class="input" name="tipo" id="plan">
                                <option value="0">Todos</option>
                            </select>
                        </div>
                        <div class="campo">
                            <b>Género</b>
                            <select class="input" name="subtipo" id="subplan">
                                <option value="0">Todos</option>
                            </select>
                        </div>
                        <div class="campo">
                            <b>Empieza el</b>
                            <input class="input" type="text" name="fecha" size="15" id="fecha" readonly="readonly" value="<?php echo formatoFechaStandard(date("Y-m-d")); ?>"/> 
                        </div>
                    </div>
                
                <div style="clear:both"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default boton" data-dismiss="modal">Cerrar</button>
                <input type="submit" class="btn btn-info boton" value="Enviar">
              </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $("#fecha").datepicker({
            defaultDate: '<?php echo formatoFechaStandard($datos['fechaNacimiento']) ?>'
        });
    });
    
    function validarFormulario() {
        campo = document.getElementById("titular");
        if (campo.value == "") {
            campo.style.borderColor = "red";
            campo.style.boxShadow = "0px 0px 5px red";
            return false;
        } else {
            campo.style.borderColor = "silver";
            campo.style.boxShadow = "none";
        }
        campo = document.getElementById("descripcion");
        if (campo.value == "") {
            campo.style.borderColor ="red";
            campo.style.boxShadow = "0px 0px 5px red";
            return false;
        } else {
            campo.style.borderColor = "silver";
            campo.style.boxShadow = "none";
        } 
        campo = document.getElementById("provincia"); 
        if (campo.value == 0) {
            campo.style.borderColor ="red";
            campo.style.boxShadow = "0px 0px 5px red";
            return false;
        } else {
            campo.style.borderColor = "silver";
            campo.style.boxShadow = "none";
        }                
        campo = document.getElementById("municipio");
        if (campo.value == 0) {
            campo.style.borderColor ="red";
            campo.style.boxShadow = "0px 0px 5px red";
            return false;
        } else {
            campo.style.borderColor = "silver";
            campo.style.boxShadow = "none";
        } 
        campo = document.getElementById("plan");   
        if (campo.value == 0) {
            campo.style.borderColor ="red";
            campo.style.boxShadow = "0px 0px 5px red";
            return false;
        } else {
            campo.style.borderColor = "silver";
            campo.style.boxShadow = "none";
        }      
        campo = document.getElementById("subplan");
        if (campo.value == 0) {
            campo.style.borderColor ="red";
            campo.style.boxShadow = "0px 0px 5px red";
            return false;
        } else {
            campo.style.borderColor = "silver";
            campo.style.boxShadow = "none";
        } 
        return true;
    }
</script>